#include "SimpleTimer.h"

//Yih----------------------------------------------------
//SimpleTimer Class for LaSalle Game 2k13  
//Date Created: 1/27/2k13
//NOTES: 
//-------------------------------------------------------

Timer::Timer( float StartTime, float EndTime)

{
	mStartTime = StartTime;
	mEndTime = EndTime;
}

Timer::~Timer(){}

void Timer::Update(float dt)
{
	if(mStartTime > mEndTime)
		mStartTime -= dt;
		
	if(mStartTime <= mEndTime)
	{
		//mStatus = FINISHED; 
	}
}

void Timer::RenderTimer(HDC bbDC, int posX, int posY)
{		
	HFONT hOldFont;
	COLORREF oldColor;
	HFONT hFont = CreateFont( 20, 15, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "Times New Roman" );
	hOldFont = (HFONT)SelectObject( bbDC, hFont );
	SetBkMode( bbDC, TRANSPARENT  );
	
	oldColor = SetTextColor( bbDC, RGB(0, 0, 0 ) ); 

	char Buffer[50];
	sprintf(Buffer, "Time Left: %i", mStartTime);
	
	TextOut( bbDC, posX, posY,  Buffer, strlen(Buffer)); // player1 time
	SelectObject( bbDC, hOldFont );
	//NEVER FORGET TO DELETE.. It paints every frame so you've got to delete 
	DeleteObject( hFont );	
	DeleteObject( hOldFont);
}
